import request from '@/utils/request'
const req = request.service;

export function login(data) {
    return req({
        url: '/auth/login',
        method: 'post',
        data
    })
}

export function info() {
    return req({
        url: '/auth/info',
        method: 'post',
        data: {}
    })
}

export function logout() {
    return req({
        url: '/auth/logout',
        method: 'post',
        data:{}
    })
}

export function queryRole(data){

    const postData = data || {}
    return req({
        url: "/auth/role",
        method: 'post',
        data:postData
    })
}

export function queryMenu(data){

    const postData = data || {}
    return req({
        url: "/auth/menu",
        method: 'post',
        data:postData
    })
}

export function saveMenu(data){

    return req({
        url: "/auth/menu/save",
        method: 'post',
        data:data
    })
}

export function queryMenuTree(){

    return req({
        url: "/auth/menu/tree",
        method: 'post',
        data:{}
    })
}

export function queryUrl(data){

    const postData = data || {}
    return req({
        url: "/auth/url",
        method: 'post',
        data:postData
    })
}

export function addUrl(data){

    return req({
        url: "/auth/url/add",
        method: 'post',
        data:data
    })
}

export function delUrl(data){

    return req({
        url: "/auth/url/delete",
        method: 'post',
        data:data
    })
}

export default{
    login,
    info,
    logout,
    queryMenuTree,
    saveMenu,
    queryMenu,
    queryRole,
    queryUrl,
    addUrl,
    delUrl
}